import request from '/@/utils/request';

//---- 门店管理 -----
// 列表
export const fetchStoreList =  (params?: object) => {
	return request({
		url: '/shop',
		method: 'get',
		params,
	});
}

// 新增
export const fetchCreateStore = (data:any) => {
	return request({
		url: '/shop/create',
		method: 'post',
		data,
	});
};

// 详情
export const fetchStoreDetail = (params:any) => {
  return request({
		url: '/shop/detail',
		method: 'get',
		params,
	});
}

// 编辑
export const fetchUpdateStore = (data:any) => {
	return request({
		url: '/shop/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelStore = (data:any) => {
  return request({
		url: '/shop/delete',
		method: 'post',
		data,
	});
}

// 状态
export const fetchStoreStatus = (data:any) => {
  return request({
		url: '/shop/switch',
		method: 'post',
		data,
	});
}

// 导入
export const fetchStoreImport = (data:any) => {
  return request({
		url: '/shop/import',
		method: 'post',
		headers: { 'Content-Type': 'application/x-www-form-urlencoded' },
		data,
	});
}

// 模板下载
export const fetchStoreDownload = (params:any) => {
  return request({
  url: '/template/门店导入模板.xlsx',
  method: 'get',
  responseType: 'blob',
  params,
 });
}

// 门店导入记录
export const fetchStoreImportRecord = (params:any) => {
  return request({
		url: '/shop/import/record/page',
		method: 'get',
		params,
	});
}





//---- 门店类型 -----
// 列表
export const fetchStoreTypeList =  (params?: object) => {
	return request({
		url: '/shop/type',
		method: 'get',
		params,
	});
}
// 新增
export const fetchCreateStoreType = (data:any) => {
	return request({
		url: '/shop/type/create',
		method: 'post',
		data,
	});
};

// 编辑
export const fetchUpdateStoreType = (data:any) => {
	return request({
		url: '/shop/type/update',
		method: 'post',
		data,
	});
};

// 删除
export const fetchDelStoreType = (data:any) => {
  return request({
		url: '/shop/type/delete',
		method: 'post',
		data,
	});
}
